package com.lijiajia.cloud.common.core.pojo.mybatisplus;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 分页查询
 *
 * @param <Entity> 实体
 * @author lijiajia
 * @since 2019-3-23
 */
public abstract class AbstractPageQuery<Entity> extends Page<Entity> implements Query<Entity> {
    public Page<Entity> setSize(long size) {
        if (size <= 0L) {
            size = 10L;
        }
        return super.setSize(size);
    }

    @Override
    public Page<Entity> setCurrent(long current) {
        if (current <= 0L) {
            current = 1L;
        }
        return super.setCurrent(current);
    }

    @Override
    public abstract QueryWrapper<Entity> transform();
}
